package design.patterns.behavioral.strategy;

import java.util.HashMap;

/**
 * @author gjx
 * @version v1.0
 * @Description
 * @date 2019/4/10 11:08
 */
public class LoginStrategyFactory {
    private static HashMap<String,LoginStrategy> STRATEGY_MAP = new HashMap<>();

    static {
        STRATEGY_MAP.put(LoginStrategyKey.QQ,new QQLogin());
        STRATEGY_MAP.put(LoginStrategyKey.WeChat,new WeChatLogin());
    }

    private interface LoginStrategyKey{
        String QQ = "qq";
        String WeChat = "WeChat";
    }

    public static LoginStrategy getLoginStrategy(String key){
        LoginStrategy loginStrategy = STRATEGY_MAP.get(key);
        return loginStrategy;
    }
}
